package com.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.entity.SingerType;
import com.service.SingerTypeService;

/**
 * 歌手类型
 * @author Shinelon 
 *
 */
@RequestMapping("/singerType")
@Controller
public class SingerTypeController {
	
	@Autowired
	private SingerTypeService singerTypeService;
	
	@RequestMapping("/singerType_show")
	public String singerType_show(Model model) {
		List<Map<String, Object>> singerTypeList = singerTypeService.querySingerType();
		model.addAttribute("singerTypeList", singerTypeList);
		return "admin/singerType";
	}
	
	@RequestMapping("/singerType_add_show")
	public String singerType_add_show() {
		return "admin/singerType-add";
	}
	
	@RequestMapping("/singerType_add_submit")
	public String singerType_add_submit(SingerType singerType) {
		singerTypeService.addSingerType(singerType);
		return "admin/singerType-add";
	}
	
	@RequestMapping("/singerType_update_show")
	public String singerType_update_show(Integer singerTypeId,Model model) {
		Map<String, Object> singerTypeMap = singerTypeService.querySingerTypeId(singerTypeId);
		model.addAttribute("singerTypeMap", singerTypeMap);
		return "admin/singerType-edit";
	}
	
	@RequestMapping("/singerType_update_submit")
	public String singerType_update_submit(SingerType singerType) {
		singerTypeService.editSingerType(singerType);
		return "admin/singerType-edit";
	}
	
	@RequestMapping("/singerType_delete")
	public String singerType_delete(Integer singerTypeId) {
		singerTypeService.delSingerType(singerTypeId);
		return "admin/singerType";
	}
}
